package java_thinking.unit_13._13_6;

import java.util.Arrays;

/**
 * @Description : 检查一个句子是否以大写字母开头，以句号结尾
 * @author: cww
 * @DateTime: 2019-03-24 23:48
 */

public class E7 {
    public static boolean matches(String text){
        return text.matches("\\p{javaUpperCase}.*\\.");
    }
    public static void split(String regex) {
        System.out.println(
                Arrays.toString(Splitting.knights.split(regex)));
    }
    public static void main(String[] args) {
        System.out.println(matches("This is correct."));
        System.out.println(matches("bad sentence 1."));
        System.out.println(matches("Bad sentence 2"));
        System.out.println(matches("This is also correct..."));
        //将字符串在the和you处分割
        split("the|you");
        //用下划线替换所有元音字母
        System.out.println(Splitting.knights.replaceAll(
                "(?i)[aeiou]","_"));
    }
}
